package com.javaspeak.algorithm.reversearray;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;

import org.junit.Test;
import org.junit.internal.TextListener;
import org.junit.runner.JUnitCore;

public class ReverseTest {
	
	@Test
	public void testReverseTwo(){
		
		String names[] = { "Aaa", "Baa" };
		String expected[] = { "Baa", "Aaa" };
		
		Reverse.reverse( names );
		
		assertEquals( Arrays.equals( expected, names ), true );
	}
	
	@Test
	public void testReverseOdd(){
		
		String names[] = { "Aaa", "Baa", "Caa", "Ddd", "Eee" };
		String expected[] = { "Eee", "Ddd", "Caa", "Baa", "Aaa" };
		
		Reverse.reverse( names );
		
		assertEquals( Arrays.equals( expected, names ), true );
	}
	
	@Test
	public void testReverseEven(){
		
		String names[] = { "Aaa", "Baa", "Caa", "Ddd", "Eee", "Fff" };
		String expected[] = { "Fff","Eee", "Ddd", "Caa", "Baa", "Aaa" };
		
		Reverse.reverse( names );
		
		assertEquals( true, Arrays.equals( expected, names ) );
	}
	
	
	public static void main( String args[] ){
		
		JUnitCore junitCore = new JUnitCore();
		junitCore.addListener( new TextListener( System.out ) );
		junitCore.run( ReverseTest.class );		
	}
}
